/**
 * Created by loso on 2017/3/23.
 */
public class _303_RangeSumQueryImmutable {


}

class NumArray {

    int[] Numsum ;

    public NumArray(int[] nums) {
        Numsum = new int[nums.length+1];
        Numsum[0] = 0;
        for (int i = 0; i < nums.length+1; i++) {
            Numsum[i+1]= Numsum[i] + nums[i];
        }
    }

    public int sumRange(int i, int j) {
        return Numsum[j+1] - Numsum[i];
    }
}